package com.gxa.hualianeshop.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.gxa.hualianeshop.entity.pojo.Spu;
import com.gxa.hualianeshop.mapper.SpuMapper;
import com.gxa.hualianeshop.service.SpuService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 *
 * @author bill
 * @date 2023/7/21 16:28
 */

//@Service

//FIXME 本地测试完成后, 需启用dubbo的Service
@org.apache.dubbo.config.annotation.Service

//public class SpuServiceImpl extends ServiceImpl<SpuMapper,Spu> implements SpuService {

public class SpuServiceImpl  implements SpuService {

    @Autowired
    private SpuMapper spuMapper;


    @DS("goods_slave")
    @Override
    public Spu getById(Long id) {
        return spuMapper.selectById(id);
    }

    @DS("goods_master")
    @Override
    public Spu save(Spu spu) {
        int insert = spuMapper.insert(spu);
        return insert>0?spu : null;
    }


}
